import 'dart:ui';

class PieData {
  PieData(this.xData, this.yData, {this.text});

  final String xData;
  final num yData;
  final String? text;
}

class ChartData {
  ChartData(this.x, this.y, this.color, {this.text});

  String x;
  num y;
  Color? color;
  String? text;

  ChartData copyWith({String? x, num? y, Color? color, String? text}) {
    return ChartData(
      x ?? this.x,
      y ?? this.y,
      color ?? this.color,
      text: text ?? this.text,
    );
  }
}

extension ListChartDataX on List<ChartData> {
  num get total => fold(0, (p, e) => p + e.y);
}
